/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.spakehelpdesk.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author leehoanh
 */
@Entity
@Table(name = "Priority", catalog = "HelpDesk", schema = "dbo")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Priority.findAll", query = "SELECT p FROM Priority p"),
    @NamedQuery(name = "Priority.findByPriorityID", query = "SELECT p FROM Priority p WHERE p.priorityID = :priorityID"),
    @NamedQuery(name = "Priority.findByPriorityName", query = "SELECT p FROM Priority p WHERE p.priorityName = :priorityName"),
    @NamedQuery(name = "Priority.findByDescription", query = "SELECT p FROM Priority p WHERE p.description = :description")})
public class Priority implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue
    @Basic(optional = false)
    @NotNull
    @Column(name = "PriorityID", nullable = false)
    private Integer priorityID;
    @Size(max = 50)
    @Column(name = "PriorityName", length = 50)
    private String priorityName;
    @Size(max = 50)
    @Column(name = "Description", length = 50)
    private String description;
    @OneToMany(mappedBy = "priorityID")
    private List<Complaint> complaintList;

    public Priority() {
    }

    public Priority(Integer priorityID) {
        this.priorityID = priorityID;
    }

    public Integer getPriorityID() {
        return priorityID;
    }

    public void setPriorityID(Integer priorityID) {
        this.priorityID = priorityID;
    }

    public String getPriorityName() {
        return priorityName;
    }

    public void setPriorityName(String priorityName) {
        this.priorityName = priorityName;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public List<Complaint> getComplaintList() {
        return complaintList;
    }

    public void setComplaintList(List<Complaint> complaintList) {
        this.complaintList = complaintList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (priorityID != null ? priorityID.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Priority)) {
            return false;
        }
        Priority other = (Priority) object;
        if ((this.priorityID == null && other.priorityID != null) || (this.priorityID != null && !this.priorityID.equals(other.priorityID))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.spakehelpdesk.entity.Priority[ priorityID=" + priorityID + " ]";
    }
    
}
